<template>
    <div>
        <el-form :model="customForm" :rules='rules' ref='customForm' label-width='100px' class='demo-ruleForm'>
            <el-form-item label='客户公司'>
                <el-input type="text" v-model="customForm.custom"></el-input>
            </el-form-item>
            <el-form-item label='发件公司'>
                <el-select v-model="customForm.office">
                    <el-option v-for="i in office_list" :key=i.id :label=i.office :value=i.id>
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="地址">
                <el-input v-model="customForm.address"></el-input>
            </el-form-item>
            <el-form-item label='phone'>
                <el-input v-model="customForm.phone"></el-input>
            </el-form-item>
            <el-form-item label='phone2'>
                <el-input v-model="customForm.phone2"></el-input>
            </el-form-item>
            <el-form-item label='name'>
                <el-input v-model="customForm.name"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button @click='submit' type='primary'>
                    提交
                </el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
import { office_get, custom_post } from "../axios_api/api";
export default {
    data(){
        return{
            office_list:[],
            customForm:{
                custom:'',
                office:'',
                address:'',
                phone:'',
                phone2:'',
                name:'',
            },
            rules:{
                
            }
        }
    },
    mounted(){
        this.get_office()
    },
    methods:{
        submit(){
            this.customForm.phone = String(this.customForm.phone)
            this.customForm.phone2 = String(this.customForm.phone2)
            custom_post(this.customForm).then(resp=>{
                this.$message(resp.message)
            })
        },
        get_office(){
            office_get().then(resp=>{
                this.office_list = resp.data
            })
        }  
    }
}
</script>

<style>

</style>
